package orderCanel;

import org.quartz.*;
import org.quartz.impl.StdSchedulerFactory;

/**
 * @author: cuiyutian1
 * @date: 2022/1/3 21:08
 * @description:
 */
public class OrderJob implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("scan db ......");
    }

    public static void main(String[] args) throws SchedulerException {
        JobDetail build = JobBuilder.newJob(OrderJob.class)
                .withIdentity("job1", "group1").build();

        SimpleTrigger trigger = TriggerBuilder.newTrigger()
                .withIdentity("trigger1", "group3")
                .withSchedule(SimpleScheduleBuilder.simpleSchedule()
                        .withIntervalInSeconds(3).repeatForever()).build();

        Scheduler scheduler = new StdSchedulerFactory().getScheduler();
        scheduler.scheduleJob(build, trigger);

        scheduler.start();;
    }
}
